import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "user",
    component: () => import("../Layout/layout.vue"),
    redirect: "/user",
    children: [
      {
        path: "user",
        name: "user",
        component: () => import("../views/User.vue"),
      },
      {
        path: "add",
        name: "add",
        component: () => import("../components/add/add.vue"),
      },
      {
        path: "all",
        name: "all",
        component: () => import("../components/all/all.vue"),
      },
      {
        path: "daifahuo",
        name: "daifahuo",
        component: () => import("../components/daifahuo/daifahuo.vue"),
      },
      {
        path: "fahuo",
        name: "fahuo",
        component: () => import("../components/fahuo/fahuo.vue"),
      },
    ],
  },
  {
    path: "/login",
    name: "login",
    component: () => import("../components/login/login.vue"),
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
